package com.laicunba.ext.web.controller.h5.activity;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.laicunba.ext.web.controller.BaseController;
import com.laicunba.pojo.RegistryDO;
import com.laicunba.service.RegistryService;

@Controller
@RequestMapping(value = "/h5/ext/activity")
public class NoticePageController extends BaseController {

	@Autowired
	private RegistryService registryService;

	@RequestMapping(value = "/notice.htm")
	public ModelAndView noticePage(String id) {
		ModelAndView view = new ModelAndView();
		RegistryDO registryDO = registryService.get(RegistryDO.class, "sys.notice." + id);
		if (registryDO != null) {
			JSONObject json;
			try {
				json = (JSONObject) new JSONParser().parse(registryDO.getVal());
				view.addObject("notice", json);
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		view.setViewName("notice.jsp");
		return view;
	}
}
